package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.model.ProductModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;
import com.cn.wanxi.service.ProductService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/contactUs")
public class ContactUsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        /////////////////////////////////////////////////////////////////导航部分广告
        //导航会有六个不同的对象，然后一起发送到前端页面
        NavService navService = new NavService();
        ArrayList<NavModel> navModelList = navService.getNavModelListForHome();
        req.setAttribute("navModelList",navModelList);
        //java 的四大作用域
        //////////////////////////////////////////////////////////////公司信息
        CompanyService companyService = new CompanyService();
        CompanyModel companyModel = companyService.getCompanyModel();
        req.setAttribute("company",companyModel);
        ///////////////////////////////////////////////////////////底部公司信息
        CompanyModel companyModel5 = companyService.getCompanyModelbottom();
        req.setAttribute("company5",companyModel5);
        ////////////////////////////////////////////////////////////得到联系我们的大图小图
        CompanyModel companyModel2 = companyService.getContactUsImgCompanyModel();
        req.setAttribute("companyModel2",companyModel2);
        /////////////////////////////////////////////////////////得到联系我们的导航
        ArrayList<NavModel> navModelList2 = navService.getNavModelListForAboutUs();
        req.setAttribute("navModelList2",navModelList2);
        ///////////////////////////////////////////////////////////得到联系我们的公司信息
        CompanyModel companyModel3 = companyService.getContactUsCompanyInformationModel();
        req.setAttribute("companyModel3",companyModel3);
        ////////////////////////////////////////////////////////////得到关于我们的轮播产品集合
        ProductService productService = new ProductService();
        ArrayList<ProductModel> productModelList3 = productService.getCarouselProductModelListForAboutUs();
        req.setAttribute("productModelList2",productModelList3);




        req.getRequestDispatcher("/jsp/contactUs.jsp").forward(req,resp);
    }
}
